The present invention relates to the conversion and modification of digital fonts.
A set of characters with a particular design is called a xe2x80x9ctypefacexe2x80x9d. A digital font (referred to here simply as a xe2x80x9cfontxe2x80x9d), such as a PostScript(copyright) font available from Adobe Systems Incorporated of San Jose, Calif. (xe2x80x9cAdobexe2x80x9d), generally includes instructions (normally read and interpreted by rendering programs executing on programmable processors) for rendering characters in a particular typeface.
The OpenType(trademark) font format was jointly developed by Adobe and Microsoft Corporation of Redmond, Wash. (xe2x80x9cMicrosoftxe2x80x9d).
OpenType fonts include a variety of tables, and optionally include OpenType Layout tables, which allow font creators to design better international and high-end typographic fonts. The OpenType Layout tables contain information on glyph substitution, glyph positioning, justification, and baseline positioning, enabling text-processing applications to improve text layout. The tables contain binary data representing typographic features, which can in that form be added to OpenType fonts. For example, the glyph substitution (xe2x80x98GSUBxe2x80x99) table in an OpenType font can contain a ligature (xe2x80x98ligaxe2x80x99) feature that could specify that adjacent f and i glyphs in a body of text set in the font be replaced by the fi ligature glyph in the font. Traditionally, such tables have been created by writing specific programs to generate the binary data or by first preparing a text input file that details the values that go into each font table data structure, and then running a tool that assembles the textual representation into the binary form required by OpenType. The first of these approaches lacks flexibility while the latter, exemplified by the True Type Open Assembler (TTOASM) developed by Microsoft, is very low level and requires complete knowledge of the underlying data structures and is thus unsuitable for font editors who tend to have graphic arts training rather than computer science backgrounds.
The invention provides methods and apparatus that process a front-end editable text filexe2x80x94which will be referred to as a feature filexe2x80x94that a user (such as a font editor) can use to define changes to an existing font file, such as an OpenType(trademark) font file, or to create a font file. The feature file contains simple logic statements for the specification of various typographical features, such as layout features, that may enhance or supplement a source font. The feature file may contain override values for fields in font tables. The feature file can be processed in combination with an existing font file to establish an enhanced font file.
In general, in one aspect, the invention features a method of adding typographic features to a font. The method includes providing a feature file containing feature definitions expressed in a high-level feature definition language; reading and parsing the feature file in a computer program to generate internal representations of the feature definitions and storing the internal representation in computer memory; converting the feature definitions into font table or subtable definitions; and writing out the table or subtable definitions into a font file.
In general, in another aspect, the invention features a system operable to add typographic features to a font. The system includes a programmable computer having an instruction processor, random access memory, and data file memory; means for reading a feature file containing feature definitions expressed in a high-level feature definition language; means for parsing the feature file to generate internal representations of the feature definitions; means for storing the internal representation in the random access memory; means for converting the feature definitions into font table or subtable definitions; and means for writing out the table or subtable definitions into a font file stored in the data file memory.
In general, in another aspect, the invention features a computer program product, tangibly stored on a computer-readable medium, for adding typographic features to a font. The product includes instructions operable to cause a computer to read a feature file containing feature definitions expressed in a high-level feature definition language; to parse the feature file to generate internal representations of the feature definitions; to store the internal representation in a memory; to convert the feature definitions into font table or subtable definitions; and to write out the table or subtable definitions into a font file.
In its various implementations, the invention can include one or more of the following advantageous features. The invention reads the feature file, including any other files included by an include mechanism, and extracts the rules, reporting any errors found in the feature file. It groups the rules appropriately by type and decides what table and subtable format to use for each group of rules. A specific font table or subtable can be identified inferentially from a substitution rule statement. Shared data structures can be created without user intervention from the feature definitions and redundancies can be removed before writing out the feature definitions into a font file. The feature definition language can be defined without constructs to express a subtable format selection.
Advantages that can be seen in implementations of the invention include one or more of the following. The flexible form in which user-defined features can be specified in the feature file accommodates a wide variety of font characteristics. Font features are specified using an English-like grammar in a data file which may be created and modified using any text editor. This provides great flexibility and considerably facilitates the task of the font editor who is producing or modifying a font. The font editor does not have to know details of the underlying data structures. The user can use language constructs that are not limited to a one-to-one correspondence with font data structures. The appropriate format of subtables is automatically selected. Modification to the font is made in a manner that facilitates efficient file storage. Optimizations are performed on shared data, which reduces the size of the font. A mechanism to include other files can be used to share data that is standard across fonts. A parser provides error feedback to the editor when errors are encountered in the feature file. A glyph name-aliasing mechanism can be used. Algorithmic creation of an all alternates (aalt) feature is provided.
The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below. Other features and advantages of the invention will become apparent from the description, the drawings, and the claims.